﻿<%@ Page Title="推荐视频" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="RecommendVideo.aspx.cs" Inherits="Xpus.YouYTube.WebSite.Views.Video.RecommendVideo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
td{padding:2px 0}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="box">
<div class="bt">推荐视频</div>
<div class="bc">
	<form id="recommendForm" action="/Video/RecommendSubmit" method="post">
	<fieldset>
		<legend>您的信息</legend>
		<div>您的大名：<input type="text" name="txtUserName" maxlength="50" size="12" class="txt" />
		您的个人网址：<input type="text" name="txtUserUrl" maxlength="1024" size="45" class="txt" /></div>
	</fieldset>
	<fieldset>
		<legend>视频信息</legend>
		<div>
		<table>
		<tr><td>标题：</td><td><input type="text" name="txtTitle" maxlength="1024" size="78" class="txt" /></td></tr>
		<tr><td>简介：</td><td><textarea name="txtDescription" cols="60" rows="5" class="txt"></textarea></td></tr>
		<tr><td>页面地址：</td><td><input type="text" name="txtSource" maxlength="1024" size="78" class="txt" /></td></tr>
		<tr><td>嵌入代码：</td><td><input type="text" name="txtEmbeddedCode" size="78" class="txt" /></td></tr>
		</table>
		</div>
	</fieldset>
	</form>
	<p><button id="btnSubmit">提交推荐的视频</button></p>
</div>
</div>

<script type="text/javascript">
var theRecommendForm;
var theRecommendButton;

function getEl()
{
	theRecommendForm = YAHOO.util.Dom.get("recommendForm");
	theRecommendButton = YAHOO.util.Dom.get("btnSubmit");
}

function makeRecommend()
{
	theRecommendButton.disabled = true;
	var callback =
	{
		success: function(o)
		{
			var data = YAHOO.lang.JSON.parse(o.responseText);
			
			if(data.IsError)
			{
				alert(data.Message);
			}
			else
			{
				theRecommendForm.reset();
				alert(data.Message);
			}
				
			theRecommendButton.disabled = false;
		},
		failure: function(o)
		{
			alert("[连接错误，提交失败]");
			theRecommendButton.disabled = false;
		},
		timeout: 30000
	};
	var data = YAHOO.util.Connect.setForm(theRecommendForm);
	YAHOO.util.Connect.asyncRequest("POST", "/Video/RecommendSubmit/", callback, null);
}

function init()
{
	getEl();
	YAHOO.util.Event.addListener(theRecommendButton, "click", makeRecommend);
}

YAHOO.util.Event.onDOMReady(init);
</script>
</asp:Content>
